package com.cdtu.comon;

import com.cdtu.entity.Admin;

/**
* 基于ThreadLocal封装的工具类 用来保存或获取当前登录管理员的
* */
public class BaseContext {
    //以线程为作用域
    private static ThreadLocal<Admin> threadLocal=new ThreadLocal<>();
    public static void setCurrentAdmin(Admin admin){
        threadLocal.set(admin);
    }
    public static Admin getCurrentAdmin(){
        return  threadLocal.get();
    }
}
